package com.example.service.impl;

import com.example.mapper.OutMaterialsMapper;
import com.example.pojo.Order;
import com.example.pojo.OutMaterials;
import com.example.pojo.PageBean;
import com.example.service.OutMaterialsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.util.List;

@Service
public class OutMaterialsServiceImpl implements OutMaterialsService {
    @Autowired
    private OutMaterialsMapper outMaterialsMapper;

    @Override
    public PageBean page(Integer page, Integer pageSize, String mname, int num, LocalDate begin, LocalDate end) {
        Long count = outMaterialsMapper.count(mname,num,begin,end);//总数返回
        Integer start=(page-1)*pageSize;//计算起始位置
        List<OutMaterials> empList = outMaterialsMapper.page(start, pageSize,mname,num,begin,end);//该页记录数返回

        PageBean pageBean = new PageBean(count, empList);
        return pageBean;
    }

    @Override
    public void delete(int[] id) {
        outMaterialsMapper.delete(id);
    }
}
